
##We performed our own imputation for the the second part of the paper.  This is because in the process of adding new variables to the dataset, we had missingness that needed to be dealt with.  We perform the same imputation process as GGW.  In that sense, we are merely replicating and not changing.

library(foreign)
library(Amelia)
library(Zelig)

setwd("/Users/michelemargolis/Dropbox/MIT/Spring 2001/Gov 2001/Replication Paper/Our Replication")

data.added <- read.dta("to be imputed.dta")

checkdata<- subset(data.added,year>1974)

##Drop Dominica due to missing domestic political data
checkdata<- subset(checkdata,imf_ccode!=30)
##Drop Hong Kong
checkdata<- subset(checkdata,imf_ccode!=52)
##Drop Netherlands Antilles
checkdata<- subset(checkdata,imf_ccode!=85)
##Drop St Vincent
checkdata<- subset(checkdata,imf_ccode!=103)
##Drop Sao Tome and Principe
checkdata<- subset(checkdata,imf_ccode!=104)
##Drop Seychelles
checkdata<- subset(checkdata,imf_ccode!=107)
##Drop Antigua and Barbuda
checkdata<- subset(checkdata,imf_ccode!=143)
##Drop Aruba
checkdata<- subset(checkdata,imf_ccode!=145)
##Drop Kiribati
checkdata<- subset(checkdata,imf_ccode!=162)
##Drop Marshall Islands
checkdata<- subset(checkdata,imf_ccode!=165)
##Drop Micronesia
checkdata<- subset(checkdata,imf_ccode!=166)
##Drop St Kitts and Nevis
checkdata<- subset(checkdata,imf_ccode!=174)
##Drop San Marino
checkdata<- subset(checkdata,imf_ccode!=175)
##Drop Tonga
checkdata<- subset(checkdata,imf_ccode!=180)


####IMPUTATION####

imputed1 <- amelia(checkdata, m=5, cs = "imf_ccode", ts = "year",  polytime=0, intercs = TRUE)

write.amelia(obj=imputed1, file.stem = "out_", format = "dta")






